package prawnBot;

import lejos.nxt.Motor;

/**
 * Set of static methods to control the robot's claw.
 * 
 * @author Stephane Beniak - 260324952
 * 
 * @see BlockFinder
 */
public class Claw {
   
   /** Defines the motor to be used by the claws. */
   public static Motor claws = Motor.C;
   
   /**
    * Initializes the claw by resetting its speed and tacho count.
    */
   public static void init() {
      claws.setSpeed(75);
      claws.resetTachoCount();
   }
   
   /** 
    * Close the claws around the pallet and grab it.
    * Lifts it to max height.
    */
   public static void grab() {
      claws.setSpeed(75);
      claws.rotateTo(120);
   }
   
   /**
    * Lift the pallet just off the ground so that it doesn't block the top US sensor.
    */
   public static void liftLow() {
      claws.setSpeed(75);
      claws.rotateTo(70);
      claws.lock(10);
   }
   
   /**
    * Lift the pallet fairly high so it doesn't block the low US sensor.
    */
   public static void liftHigh() {
      claws.setSpeed(75);
      claws.rotateTo(120);
      claws.lock(10);
   }
   
   /** 
    * Lower the claws and release the pallet
    */
   public static void release() {
      claws.setSpeed(75);
      claws.rotateTo(0);
   }
   
   /** 
    * Slowly lower the claws and release the pallet gently onto another pallet
    */
   public static void stack() {
      claws.setSpeed(75);
      claws.rotateTo(90);
      claws.setSpeed(25);
      claws.rotateTo(0);
   }
   
}